﻿using System;

class NTryCatch {
  class MyException : Exception { 
    public MyProperty : string = "MyException";
  }
  
  SafeCall(action : void -> void) : void {
    try {
      action();
    } catch {
      | my is MyException => Console.WriteLine(my.MyProperty);
      | e                 => Console.WriteLine(e.Message)
    }
  }
  
  public ExecptionShow() : void {
    SafeCall(fun() { throw MyException() });
    SafeCall(fun() { throw ArgumentException("WTF?") });
  }
}
